
#import "NSString+path.h"

@implementation NSString (path)


- (NSString *)appendCachePath
{
    // 获取cache文件目录
    NSString *path = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).lastObject;
    
    // 获取文件名字
    NSString *name = [self lastPathComponent];
    
    // 路径拼接文件名
    NSString *filePath = [path stringByAppendingPathComponent:name];
    
    return filePath;
}

- (NSString *)appendTempPath
{
    // 获取temp文件目录
    NSString *path = NSTemporaryDirectory();
    // 获取文件名字
    NSString *name = [self lastPathComponent];
    // 路径拼接文件名
    NSString *filePath = [path stringByAppendingPathComponent:name];
    
    return filePath;
}

@end
